/**
 * 
 */
package org.statewalker.core;

public class DelegateState implements IState {

    private IState fState;

    /**
     * @param state
     */
    public DelegateState(IState state) {
        fState = state;
    }

    /**
     * @see org.statewalker.core.IState#activate(org.statewalker.core.IEvent,
     *      org.statewalker.core.IState.ICallback)
     */
    public void activate(IEvent event, ICallback callback) {
        fState.activate(event, callback);
    }

    /**
     * @see org.statewalker.core.IState#deactivate(org.statewalker.core.IEvent,
     *      org.statewalker.core.IState.ICallback)
     */
    public void deactivate(IEvent event, ICallback callback) {
        fState.deactivate(event, callback);
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof DelegateState)) {
            return false;
        }
        DelegateState o = (DelegateState) obj;
        return fState.equals(o.fState);
    }

    /**
     * @see org.statewalker.core.IState#getContext()
     */
    public IProcessContext getContext() {
        return fState.getContext();
    }

    /**
     * @see org.statewalker.core.IState#getKey()
     */
    public String getKey() {
        return fState.getKey();
    }

    /**
     * @see org.statewalker.core.IState#getParent()
     */
    public IState getParent() {
        return fState.getParent();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return fState.hashCode();
    }

    public void onTransition(IState prev, IEvent event, IState next) {
        fState.onTransition(prev, event, next);
    }

    /**
     * @see org.statewalker.core.IState#setContext(org.statewalker.core.IProcessContext)
     */
    public void setContext(IProcessContext context) {
        fState.setContext(context);
    }

    /**
     * @see org.statewalker.core.IState#setKey(java.lang.String)
     */
    public void setKey(String stateKey) {
        fState.setKey(stateKey);
    }

    /**
     * @see org.statewalker.core.IState#setParent(org.statewalker.core.IState)
     */
    public void setParent(IState parent) {
        fState.setParent(parent);
    }

    @Override
    public String toString() {
        return fState.toString();
    }

}